<!--/**-->
<!-- * Created by PhpStorm.-->
<!-- * User: liuhui-->
<!-- * Date: 2016/9/27-->
<!-- * Time: 15:34-->
<!-- */-->
<extend file='resource/view/master'/>
<block name="content">
	<style>
		th{
			text-align: center;
		}
	</style>
	<ol class="breadcrumb" style="background-color: #f9f9f9;padding:8px 0;margin-bottom:10px;">
		<li>
			<a href=""><i class="fa fa-cogs"></i>
				类型管理</a>
		</li>
		<li class="active">
			<a href="">商品列表</a>
		</li>

	</ol>
	<ul class="nav nav-tabs" role="tablist">
		<li class="active"><a href="{{u('Typeattr.index',['tid'=>$tid])}}">属性管理</a></li>

	</ul>
	<form action="" method="post">
		<div class="panel panel-default">
			<div class="panel-body">
				<table class="table table-hover">
					<thead>

					<tr>
						<th width="80">货品ID</th>
						<foreach from="$data" key="$k" value="$v">
							<th>{{$v['taname']}}</th>
						</foreach>
						<th > 货号</th>
						<th>库存</th>
						<th>操作</th>
					</tr>
					</thead>
					<tbody>
<!--					循环index数据-->
				<foreach from="$ListData" key="$k" value="$v">
						<tr style="text-align: center">
							<td>{{$v['glid']}}</td>
							<foreach from="$v['combine']" key="$kk" value="$vv">
							<td>{{$v['combine'][$kk]}}</td>
							</foreach>
							<td>
								{{$v['number']}}
							</td>
							<td>
								{{$v['inventory']}}
							</td>
							<td>
								<div class="btn-group">

										<a class="btn btn-primary btn-xs dropdown-toggle"  onclick="del({{$v['glid']}},{{$v['gid']}})">删除</a>

								</div>
							</td>
						</tr>
					</foreach>
<!--						添加框-->
						<form action=""method="post">
							<tr style="text-align: center;background: #cccccc;width: 100%">
								<td>添加货品</td>
								<foreach from="$data" key="$k" value="$v">
								<td>



											<select class="js-example-basic-single form-control" name="combine[]">1
												<option value="0">请选择</option>31
											<foreach from="$v['select']" key="$kk" value="$vv" >
												<option value="{{$vv['gaid']}}" > {{$vv['gavalue']}}</option>
											</foreach>
											</select>


								</td>
							</foreach>
								<td >

										<input type="text" name="number"placeholder="请添加商品编号">
								</td>
								<td >

										<input type="text" name="inventory" placeholder="请输入库存">
<!--										隐藏域-->
										<input type="hidden" name="gid" value="{{q('get.gid',0,'intval')}}">

								</td>
								<td>

								</td>

							</tr>

		<!--				上传按钮	-->
								<tr style="text-align: center">
									<td>
										<input type="submit" value="保存添加"  class="btn btn-primary btn-block dropdown-toggle">
									</td>

								</tr>
						</form>
					</tbody>
				</table>
			</div>
		</div>
	</form>
	<div class="pagination pagination-sm pull-right">
	</div>
</block>
<script>
//	删除提示框
	function del(glid,gid){
		var obj=util.modal({

			content:'确认删除么？',
			footer:'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button><button type="button" class="btn btn-danger confirm" data-dismiss="modal">确定</button>',//底部
			width:600,//宽度
			events:{
				confirm:function(){
					//哪个元素上有.confirm类，被点击就执行这个回调
					location.href = "{{u('del')}}" + '&glid=' + glid+"&gid="+gid;
				}
		}
		})
		obj.modal('show');
	}
</script>
